package com.xkw.boot.sys.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xkw.boot.sys.entity.User;
import com.xkw.boot.sys.mapper.UserMapper;
import com.xkw.boot.util.JsonUtil;

@RestController
public class UserController {

	@Autowired
	private UserMapper userMapper;
	//http://localhost:8080/getAllUser
	@RequestMapping("/getAllUser")
	public String getUsers() {
		List<User> users = userMapper.findAllUser();
		if(users != null && !users.isEmpty()) {
			return JsonUtil.toJson(users);
		}
		return "err";
	}
}


